package com.hmall.common.domain;

import com.hmall.common.utils.UserContext;
import org.springframework.amqp.AmqpException;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessagePostProcessor;

/**
 * ClassName: UserInfoMessagePostProcessor
 * Package:
 * Description
 * MQ 添加消息
 *
 * @Author xw
 * @Create 2023/12/15 20:29
 */
public class UserInfoMessagePostProcessor implements MessagePostProcessor {
    @Override
    public Message postProcessMessage(Message message) throws AmqpException {

        message.getMessageProperties().setHeader("user-info", UserContext.getUser());

        return message;
    }
}
